<template>
  <div class="commentitem-container" v-if="commentInfo?.nickname">
    <div class="avatar">
      <img :src="commentInfo?.avatar || ''" alt="" />
    </div>
    <div class="comment-info">
      <div class="content-top">
        <div class="nickname">{{ commentInfo?.nickname }}</div>
        <div class="date">{{ commentInfo?.createDate }}</div>
      </div>
      <div class="content">{{ commentInfo?.content }}</div>
    </div>
  </div>
</template>

<script>
export default {
  name: "CommentItem",
  props: {
    commentInfo: {
      type: Object,
      default: () => {},
    },
  },
};
</script>

<style scoped lang="less">
@import "@/styles/var.less";
.commentitem-container {
  display: flex;
  gap: 14px;
  width: 100%;
  padding: 10px 0;
  border-bottom: 1px solid @gray;
  .avatar {
    width: 40px;
    height: 40px;
    img {
      object-fit: cover;
      width: 100%;
      height: 100%;
      border-radius: 50%;
    }
  }
  .comment-info {
    flex: 1;
    .content-top {
      margin-bottom: 12px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      .nickname {
        font-size: 16px;
        color: @success;
      }
      .date {
        font-size: 14px;
        color: @gray;
      }
    }
  }
}
</style>
